{% extends 'bootstrap/base.html' %}
{% import "bootstrap/wtf.html" as wtf %}

{%block title%}学生信息管理系统{% endblock %}

{%block content%}
<div class="container">
    <div class="page-header">
    <h1>Student Records</h1> 
    <div>
        <a href="{{ url_for('index') }}" class="btn btn-primary btn-xs">所有学生</a>
        {% for m in majors %}
            <a href="{{ url_for('filter_by_major', major_id=m.id) }}" class="btn btn-default btn-xs">{{ m.major_name }}</a>
        {% endfor %}
    </div>
</div>

<div class="container">
    <h4>当前共有{{studs|length}}名学生</h4>
    <a class = "btn btn-primary" href="{{ url_for('new_stud') }}">新增学生</a>
    <div>
        {%for stud in studs%} 
        <div>
            <p style="margin:10px;">
                <strong style="font-family: '楷体';"> {{stud.name}}  </strong>
                {% if stud.major %}
                    <a class="label label-success label-xs">{{ stud.major.major_name }}</a>
                {% else %}
                    <span class="label label-default">未分配专业</span>
                {% endif %}
            </p>
            <a class="btn btn-info" href="{{url_for('edit_stud',stu_id=stud.id)}}">Edit</a> 
            <a class="btn btn-danger" href="{{url_for('del_stud',stud_id=stud.id)}}">Delete</a> 
            
        </div>
        {%endfor%}
    </div>
</div>
{%endblock%}